package hello;

import io.bloom.dubbo.sample.api.EchoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ImportResource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@RestController
@ImportResource("classpath:dubbo-docker-provider.xml")
public class Application {

    @Autowired
    private EchoService echoService;

    @RequestMapping("/")
    public String home() {
        return "Hello Docker World";
    }

    @RequestMapping("/api")
    public String api(@RequestParam(value = "message", defaultValue = "Guest") String message) {
        return echoService.echo(message);
    }

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

}
